package com.yaremchuk.androidgames.framework.impl;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import android.content.Context;
import android.content.res.AssetManager;
import android.os.Environment;

import com.yaremchuk.androidgames.framework.FileIO;

public class AndroidFileIO implements FileIO {
	
	private AssetManager assetManager;
	private String externalStoragePath;
	
	public AndroidFileIO(Context context) {
		assetManager = context.getAssets();
		externalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator;
	}

	public InputStream readAsset(String fileName) throws IOException {		
		return assetManager.open("fileName");
	}

	public InputStream readFile(String fileName) throws IOException {
		
		return new FileInputStream(externalStoragePath + fileName);
	}

	public OutputStream writeFile(String fileName) throws IOException {
		// TODO Auto-generated method stub
		return new FileOutputStream(externalStoragePath + fileName);
	}

}
